<?php

/**
 * 系统扩展类
 * @author bing.peng
 *
 */
class Ext {
	
	private $hooks = array();
	private $hookNames = array();
	
	function Ext() {
		require( APPPATH . 'exts/hook.php' );
		$this->hooks = $hooks;
	}
	
	function init(array $hooks) {
		$this->hookNames = $hooks;
	}
	
	/**
	 * 执行钩子
	 * @param $weld 挂接点
	 * @return void
	 */
	function callHook($weld) {
		foreach($this->hookNames as $name) {
			if( isset( $this->hooks[$weld][$name] ) ) {
				$hook = $this->hooks[$weld][$name];
				require_once( APPPATH . $hook['src'] );
				$HK = new $hook['class'];
				$HK->$hook['func']();
			}
		}
	}
}

?>